#include <QFile>

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ui_smssend.h"

#include <QXmlSimpleReader>
#include <QXmlInputSource>
#include <QtXml>
#include <QMessageBox>
#include <QCheckBox>
#include "log.h"
#include "globals.h"



MainWindow::MainWindow(QWidget *parent)
    :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    smsSend = new SmsSend;
    ui->setupUi(this);
    ui->tableView->setModel(globals->model());

    reloadConfig();
    connect(ui->actionReloadConfig,SIGNAL(triggered()),
            this,SLOT(reloadConfig()));


}

MainWindow::~MainWindow()
{
    smsSend->close();
    delete smsSend;
    delete ui;
#ifdef _WIN32
    //if (ClosePort) ClosePort();
    //if (hDll) CloseHandle(hDll);
#endif
}

void MainWindow::loadEnv(QString filename)
{
    globals->load(filename);
}

void MainWindow::reloadConfig()
{
    loadEnv("settings.xml");
}


void MainWindow::on_actionSendSMS_2_triggered()
{
    smsSend->show();
}
